home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 7684 / 7684.xpi / resources / hAudio.js < prev    next >
Text File  |  2009-11-20  |  3KB  |  116 lines

  1. /**
  2.  * Copyright (c) 2008, Jose Enrique Bolanos, Jorge Villalobos
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions are met:
  7.  *
  8.  *  * Redistributions of source code must retain the above copyright notice,
  9.  *    this list of conditions and the following disclaimer.
  10.  *  * Redistributions in binary form must reproduce the above copyright notice,
  11.  *    this list of conditions and the following disclaimer in the documentation
  12.  *    and/or other materials provided with the distribution.
  13.  *  * Neither the name of Jose Enrique Bolanos, Jorge Villalobos nor the names
  14.  *    of its contributors may be used to endorse or promote products derived
  15.  *    from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  20.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  21.  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  22.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  23.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  24.  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  25.  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  26.  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28.  **/
  29.  
  30. var EXPORTED_SYMBOLS = [ "hAudio" ];
  31.  
  32. const Cc = Components.classes;
  33. const Ci = Components.interfaces;
  34. const Ce = Components.Exception;
  35.  
  36. Components.utils.import("resource://gre/modules/Microformats.js");
  37.  
  38. /**
  39.  * hAudio microformat.
  40.  */
  41. if (typeof(hAudio) == 'undefined') {
  42.  
  43.   function hAudio(node) {
  44.     if (node) {
  45.       Microformats.parser.newMicroformat(this, node, "hAudio");
  46.     }
  47.   }
  48.  
  49.   hAudio.prototype.toString = function() {
  50.     return this.title;
  51.   }
  52.  
  53.   var hAudio_definition = {
  54.     mfVersion: 0.9,
  55.     description: "Audio",
  56.     mfObject: hAudio,
  57.     className: "haudio",
  58.     properties: {
  59.       "title" : {
  60.       },
  61.       "album" : {
  62.       },
  63.       "item" : {
  64.       },
  65.       "position" : {
  66.       },
  67.       "contributor" : {
  68.         datatype: "microformat",
  69.         microformat: "hCard"
  70.       },
  71.       "published" : {
  72.       },
  73.       "sample" : {
  74.         rel : true,
  75.         datatype : "custom",
  76.         customGetter : function(aPropNode) {
  77.           return aPropNode.getAttribute("href");
  78.         }
  79.       },
  80.       "enclosure" : {
  81.         rel : true,
  82.         datatype : "custom",
  83.         customGetter : function(aPropNode) {
  84.           return aPropNode.getAttribute("href");
  85.         }
  86.       },
  87.       "payment" : {
  88.       },
  89.       "photo" : {
  90.         datatype : "custom",
  91.         customerGetter : function(aPropNode) {
  92.           return aPropNode.getAttribute("src");
  93.         }
  94.       },
  95.       "category" : {
  96.         rel : true,
  97.         datatype : "microformat",
  98.         microformat : "tag"
  99.       },
  100.       "duration" : {
  101.       },
  102.       "price" : {
  103.       },
  104.       "description" : {
  105.       }
  106.     }
  107.   }
  108. }
  109.  
  110. /**
  111.  * Registers the microformat.
  112.  */
  113. (function() {
  114.   Microformats.add("hAudio", hAudio_definition);
  115. }).apply(hAudio);
  116.